home *** CD-ROM | disk | FTP | other *** search
/ BUG 1 / BUGCD1996_0708.ISO / pc / util / minilin / minilin.exe / SBIN / LILOCONF.{_B < prev    next >
Text File  |  1994-07-08  |  25KB  |  866 lines

  1. #!/bin/sh
  2. #
  3. # Copyright 1994 Patrick Volkerding, Moorhead, Minnesota USA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. #    notice, this list of conditions and the following disclaimer.
  11. #
  12. #  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
  13. #  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
  15. #  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. #  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. #  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. #  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. #  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. #  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. #  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. #
  23. checkp_text()
  24. {
  25.  if [ ! -r $1 ]; then
  26.   echo
  27.   echo "I can't find a device named '$1'!"
  28.   echo
  29.   echo -n "Are you sure you want to use this device name [y]es, [n]o? "
  30.   read use_device;
  31.   if [ ! "$use_device" = "y" ]; then
  32.    return 1;
  33.   fi
  34.   return 0;
  35.  fi
  36. }
  37. checkp_dialog()
  38. {
  39.  if [ ! -r $1 ]; then
  40.   dialog --title "DEVICE FILE NOT FOUND" --yesno "I can't find a \
  41. device named '$1'. Are you sure you want to use this device \
  42. name?" 7 60
  43.   return $?;
  44.  fi
  45. }
  46. # 'probe()' borrowed from LILO QuickInst.
  47. probe()
  48. {
  49.  [ ! -z "`dd if=$1 bs=1 count=1 2>/dev/null | tr '\0' x`" ]
  50.  return
  51. }
  52. # liloconfig-color?
  53. if [ "`basename $0`" = "liloconfig-color" ]; then
  54.  COLOR=on
  55. fi
  56. # Figure out if we're installing from the hard drive
  57. if [ -r /tmp/SeTT_PX ]; then
  58.  T_PX="`cat /tmp/SeTT_PX`"
  59. else
  60.  if [ "$T_PX" = "" -a ! "$1" = "" ]; then
  61.   T_PX=$1
  62.  else
  63.   T_PX=/
  64.  fi
  65. fi
  66. HDR="no" # this means the header section of /etc/lilo.conf has not yet
  67.          # been configured
  68. LNX="no" # this means no Linux partition has been defined as bootable
  69.          # through LILO. Both of these must change to "yes" before LILO will
  70.          # install from this script.
  71. # Determine the root partition (such as /dev/hda2)
  72. ROOT_DEVICE=$2
  73. if [ "$ROOT_DEVICE" = "" ]; then
  74.  if [ -r /tmp/SeTrootdev ]; then
  75.   ROOT_DEVICE="`cat /tmp/SeTrootdev`"
  76.  else
  77.   ROOT_DEVICE="`mount | cut -b-10 | sed -n "1 p"`"
  78.  fi
  79. fi
  80. if [ -r /tmp/SeTcolor -o "$COLOR" = "on" ]; then # use color menus, otherwise tty
  81.  while [ 0 ]; do
  82.   dialog --title "LILO INSTALLATION" --menu "LILO (the Linux Loader) allows \
  83. you to boot Linux from your hard drive. \
  84. To install, you make a new LILO configuration file by creating a new header \
  85. and then adding at least one bootable partition to the file. Once you've done \
  86. this, you can select the install option. Alternately, if you already have an \
  87. /etc/lilo.conf, you may reinstall using that. If you make a mistake, you can \
  88. always start over by choosing 'Begin'. \
  89. Which option would you like?" 22 73 9 \
  90. "Begin" "Start LILO configuration with a new LILO header" \
  91. "Linux" "Add a Linux partition to the LILO config file" \
  92. "OS/2" "Add an OS/2 partition to the LILO config file" \
  93. "DOS" "Add a DOS partition to the LILO config file" \
  94. "Install" "Install LILO" \
  95. "Recycle" "Reinstall LILO using the existing lilo.conf" \
  96. "Skip" "Skip LILO installation and exit this menu" \
  97. "View" "View your current /etc/lilo.conf" \
  98. "Help" "Read the Linux Loader HELP file"  2> /tmp/reply
  99.   if [ $? = 1 -o $? = 255 ]; then
  100.    REPLY="Skip"
  101.   else
  102.    REPLY="`cat /tmp/reply`"
  103.   fi
  104.   rm -r /tmp/reply
  105.   if [ "$REPLY" = "Begin" ]; then
  106.    dialog --title "OPTIONAL append= LINE" --inputbox "Some systems might \
  107. require extra parameters to be passed to the kernel in order to boot. An \
  108. example would be the hd=cyl,hds,secs needed with some SCSI systems and some \
  109. machines with IBM motherboards. If you \
  110. needed to pass parameters to the kernel when you booted the Slackware \
  111. bootkernel disk, you'll probably want to enter the same ones here. Most \
  112. systems won't require any extra parameters. If you don't need any, just \
  113. hit ENTER to continue." 14 72 2> /tmp/reply
  114.    if [ $? = 1 -o $? = 255 ]; then
  115.     HDR="no"
  116.     continue;
  117.    else
  118.     APPEND="`cat /tmp/reply`"
  119.    fi
  120.    dialog --title "SELECT LILO TARGET LOCATION" --menu "LILO can be installed \
  121. to a variety of places: the master boot record of your first hard drive, the \
  122. superblock of your root Linux partition (which could then be made the \
  123. bootable partition with fdisk), or a formatted floppy disk. If you're using \
  124. a boot system such as OS/2's Boot Manager, you should use the "Root" \
  125. selection. Please pick a target location:" 16 65 3 \
  126. "MBR" "Use the Master Boot Record" \
  127. "Root" "Use superblock of the root Linux partition" \
  128. "Floppy" "Use a formatted floppy disk in the boot drive" 2> /tmp/reply
  129.    if [ $? = 1 -o $? = 255 ]; then
  130.     HDR="no"
  131.     continue;
  132.    else
  133.     LNX="no"
  134.     TG="`cat /tmp/reply`"
  135.    fi
  136.    rm -r /tmp/reply
  137.    if [ "$TG" = "MBR" ]; then
  138.     if [ -L $T_PX/dev/hda ]; then
  139.      LILO_TARGET="/dev/sda"
  140.     elif probe /dev/hda; then
  141.      LILO_TARGET="/dev/hda"
  142.     elif probe /dev/sda; then
  143.      LILO_TARGET="/dev/sda"
  144.     else
  145.      dialog --msgbox "LILO can't find your first hard drive! Sorry, \
  146. but LILO is getting /dev/null'ed..." 10 50
  147.      LILO_TARGET="/dev/null"
  148.     fi
  149.    elif [ "$TG" = "Root" ]; then
  150.     LILO_TARGET=`echo $ROOT_DEVICE` # Here, we use the partition superblock for OS/2 Boot Manager
  151.    elif [ "$TG" = "Floppy" ]; then
  152.     LILO_TARGET="/dev/fd0"    
  153.    else
  154.     HDR="no"
  155.     continue;
  156.    fi
  157.    dialog --title "CHOOSE LILO DELAY" --menu "How long would you like \
  158. LILO to wait for you to hit left-shift to get a prompt after rebooting? If you \
  159. let LILO time out, it will boot the first OS in the configuration file by \
  160. default." 13 72 4 \
  161. "None" "Don't wait at all - boot straight into the first OS" \
  162. "5" "5 seconds" \
  163. "30" "30 seconds" \
  164. "Forever" "Present a prompt and wait until a choice is made" 2> /tmp/reply
  165.    if [ $? = 1 -o $? = 255 ]; then
  166.     HDR="no"
  167.     continue;
  168.    else
  169.     DELAY="`cat /tmp/reply`"
  170.    fi
  171.    rm -r /tmp/reply
  172.    if [ "$DELAY" = "None" ]; then 
  173.     DELAY="# delay = 5"
  174.    elif [ "$DELAY" = "5" ]; then
  175.     DELAY="delay = 50"
  176.    elif [ "$DELAY" = "30" ]; then
  177.     DELAY="delay = 300" 
  178.    elif [ "$DELAY" = "Forever" ]; then
  179.     DELAY="prompt"
  180.    else
  181.     HDR="no"
  182.     continue;
  183.    fi
  184.    if [ "$APPEND" = "" ]; then
  185.     cat << EOF > /tmp/lilo.conf
  186. # LILO configuration file
  187. # generated by 'liloconfig'
  188. #
  189. # Start LILO global section
  190. boot = $LILO_TARGET
  191. #compact        # faster, but won't work on all systems.
  192. $DELAY
  193. vga = normal    # force sane state
  194. ramdisk = 0     # paranoia setting
  195. # End LILO global section
  196. EOF
  197.     HDR="yes"
  198.    else
  199.     cat << EOF > /tmp/lilo.conf
  200. # LILO configuration file
  201. # generated by 'liloconfig'
  202. #
  203. # Start LILO global section
  204. append="$APPEND"
  205. boot = $LILO_TARGET
  206. #compact        # faster, but won't work on all systems.
  207. $DELAY
  208. vga = normal    # force sane state
  209. ramdisk = 0     # paranoia setting
  210. # End LILO global section
  211. EOF
  212.     HDR="yes"
  213.    fi
  214.   elif [ "$REPLY" = "Linux" ]; then
  215.    if [ "$HDR" = "yes" ]; then
  216.     echo "These are your Linux partitions:" > /tmp/tmpmsg
  217.     echo >> /tmp/tmpmsg
  218.     echo "   Device Boot  Begin   Start    End  Blocks   Id  System" >> /tmp/tmpmsg
  219.     fdisk -l | fgrep Linux | fgrep native >> /tmp/tmpmsg
  220.     echo >> /tmp/tmpmsg
  221.     echo "Which one would you like LILO to boot?" >> /tmp/tmpmsg
  222.     dialog --title "SELECT LINUX PARTITION" --inputbox \
  223. "`cat /tmp/tmpmsg`" 20 74 2> /tmp/reply
  224.     if [ $? = 1 -o $? = 255 ]; then
  225.      rm /tmp/tmpmsg
  226.      continue
  227.     fi
  228.     rm /tmp/tmpmsg
  229.     LINUX_PART="`cat /tmp/reply`"
  230.     checkp_dialog $LINUX_PART
  231.     if [ ! $? = 0 ]; then
  232.      continue;
  233.     fi
  234.     dialog --title "SELECT PARTITION NAME" --inputbox \
  235. "Now you must select a short, unique name for this partition. \
  236. You'll use this name if you specify a partition to boot at the \
  237. LILO prompt. 'Linux' might not be a bad choice. THIS MUST BE A \
  238. SINGLE WORD." 11 60 2> /tmp/reply
  239.     if [ $? = 1 -o $? = 255 ]; then
  240.      continue
  241.     fi
  242.     LABEL="`cat /tmp/reply`"
  243.     cat << EOF >> /tmp/lilo.conf
  244. # Linux bootable partition config begins
  245. image = /vmlinuz
  246.   root = $LINUX_PART
  247.   label = $LABEL
  248. # Linux bootable partition config ends
  249. EOF
  250.    else
  251.     dialog --title "CAN'T ADD LINUX PARTITION" --msgbox "You can't add \
  252. partitions unless you start over with a new LILO header." 6 60
  253.     continue
  254.    fi
  255.    LNX="yes"
  256.   elif [ "$REPLY" = "OS/2" ]; then
  257.    if [ "$HDR" = "yes" ]; then
  258.     echo "These are possibly OS/2 partitions. They will be treated" > /tmp/tmpmsg
  259.     echo "as such if you install them using this menu." >> /tmp/tmpmsg
  260.     echo >> /tmp/tmpmsg
  261.     echo "   Device Boot  Begin   Start    End  Blocks   Id  System" >> /tmp/tmpmsg
  262.     fdisk -l | fgrep DOS >> /tmp/tmpmsg
  263.     fdisk -l | fgrep HPFS >> /tmp/tmpmsg
  264.     echo >> /tmp/tmpmsg
  265.     echo "Which one would you like LILO to boot?" >> /tmp/tmpmsg
  266.     dialog --title "SELECT OS/2 PARTITION" --inputbox \
  267. "`cat /tmp/tmpmsg`" 20 74 2> /tmp/reply
  268.     if [ $? = 1 -o $? = 255 ]; then
  269.      rm /tmp/tmpmsg
  270.      continue
  271.     fi
  272.     rm /tmp/tmpmsg
  273.     OS_2_PART="`cat /tmp/reply`"
  274.     checkp_dialog $OS_2_PART
  275.     if [ ! $? = 0 ]; then
  276.      continue;
  277.     fi
  278.     dialog --title "SELECT PARTITION NAME" --inputbox \
  279. "Now you must select a short, unique name for this partition. \
  280. You'll use this name if you specify a partition to boot at the \
  281. LILO prompt. 'OS/2' might not be a bad choice. THIS MUST BE A \
  282. SINGLE WORD."  11 60 2> /tmp/reply
  283.     if [ $? = 1 -o $? = 255 ]; then
  284.      continue
  285.     fi
  286.     LABEL="`cat /tmp/reply`"
  287.     TABLE="`echo $OS_2_PART | cut -b1-8`"
  288.     if [ "`echo $TABLE | cut -b6-8`" = "hda" ]; then
  289.      cat << EOF >> /tmp/lilo.conf
  290. # OS/2 bootable partition config begins
  291. other = $OS_2_PART
  292.   label = $LABEL
  293.   table = $TABLE
  294. # OS/2 bootable partition config ends
  295. EOF
  296.     else
  297.      cat << EOF >> /tmp/lilo.conf
  298. # OS/2 bootable partition config begins
  299. other = $OS_2_PART
  300.   label = $LABEL
  301.   table = $TABLE
  302.   loader = /boot/os2_d.b
  303. # OS/2 bootable partition config ends
  304. EOF
  305.     fi
  306.    else
  307.     dialog --title "CAN'T ADD OS/2 PARTITION" --msgbox "You can't add \
  308. partitions unless you start over with a new LILO header." 6 60
  309.     continue
  310.    fi
  311.    LNX="yes"
  312.   elif [ "$REPLY" = "DOS" ]; then
  313.    if [ "$HDR" = "yes" ]; then
  314.     echo "These are possibly DOS partitions. They will be treated" > /tmp/tmpmsg
  315.     echo "as such if you install them using this menu." >> /tmp/tmpmsg
  316.     echo >> /tmp/tmpmsg
  317.     echo "   Device Boot  Begin   Start    End  Blocks   Id  System" >> /tmp/tmpmsg
  318.     fdisk -l | fgrep DOS >> /tmp/tmpmsg
  319.     echo >> /tmp/tmpmsg
  320.     echo "Which one would you like LILO to boot?" >> /tmp/tmpmsg
  321.     dialog --title "SELECT DOS PARTITION" --inputbox \
  322. "`cat /tmp/tmpmsg`" 20 74 2> /tmp/reply
  323.     if [ $? = 1 -o $? = 255 ]; then
  324.      rm /tmp/tmpmsg
  325.      continue
  326.     fi
  327.     rm /tmp/tmpmsg
  328.     DOSPART="`cat /tmp/reply`"
  329.     checkp_dialog $DOSPART
  330.     if [ ! $? = 0 ]; then
  331.      continue;
  332.     fi
  333.     dialog --title "SELECT PARTITION NAME" --inputbox \
  334. "Now you must select a short, unique name for this partition. \
  335. You'll use this name if you specify a partition to boot at the \
  336. LILO prompt. 'DOS' might not be a bad choice. THIS MUST BE A \
  337. SINGLE WORD." 11 60 2> /tmp/reply
  338.     if [ $? = 1 -o $? = 255 ]; then
  339.      continue
  340.     fi
  341.     LABEL="`cat /tmp/reply`"
  342.     unset USE_LOADER
  343.     TABLE="`echo $DOSPART | cut -b1-8`"
  344.     if [ "`echo $TABLE | cut -b6-8`" = "hda" ]; then
  345.      USE_LOADER="no"
  346.     fi
  347.     if [ "`echo $TABLE | cut -b6-8`" = "sda" ]; then
  348.      if probe /dev/hda; then
  349.       USE_LOADER="yes"
  350.      else
  351.       USE_LOADER="no"
  352.      fi
  353.     fi
  354.     if [ "$USE_LOADER" = "no" ]; then
  355.      cat << EOF >> /tmp/lilo.conf
  356. # DOS bootable partition config begins
  357. other = $DOSPART
  358.   label = $LABEL
  359.   table = $TABLE
  360. # DOS bootable partition config ends
  361. EOF
  362.     else
  363.      cat << EOF >> /tmp/lilo.conf
  364. # DOS bootable partition config begins
  365. other = $DOSPART
  366.   label = $LABEL
  367.   loader = /boot/any_d.b
  368.   table = $TABLE
  369. # DOS bootable partition config ends
  370. EOF
  371.     fi
  372.    else
  373.     dialog --title "CAN'T ADD DOS PARTITION" --msgbox "You can't add \
  374. partitions unless you start over with a new LILO header." 6 60
  375.     continue
  376.    fi
  377.    LNX="yes"
  378.   elif [ "$REPLY" = "Install" -o "$REPLY" = "Recycle" ]; then
  379.    if [ "$REPLY" = "Recycle" -a -r $T_PX/etc/lilo.conf ]; then
  380.     LNX="yes"
  381.    fi
  382.    if [ "$LNX" = "no" ]; then
  383.     dialog --title "CAN'T INSTALL LILO" --msgbox "LILO could not be \
  384. installed. If you have not created a LILO configuration file by defining \
  385. a new header and adding at least one bootable partition to it, you must do \
  386. so before installing LILO. If you were attempting to use an existing LILO \
  387. configuration file, it could not be found. Try making a new one." 9 70
  388.     continue
  389.    else
  390.     if [ "$REPLY" = "Install" ]; then
  391.      if [ -r /tmp/lilo.conf ]; then
  392.       if [ -r $T_PX/etc/lilo.conf ]; then
  393.        mv $T_PX/etc/lilo.conf $T_PX/etc/lilo.conf.bak
  394.       fi
  395.       cp /tmp/lilo.conf $T_PX/etc/lilo.conf
  396.       chmod 644 $T_PX/etc/lilo.conf
  397.      fi
  398.     fi    
  399.     dialog --infobox "\nInstalling the Linux Loader..." 5 40
  400.     if [ "$T_PX" = "/" ]; then
  401.      /sbin/lilo 1> /dev/null 2> /dev/null
  402.     else
  403.      (cd $T_PX/sbin; ./lilo -r $T_PX -m /boot/map -C /etc/lilo.conf 1> /dev/null 2> /dev/null )
  404.     fi
  405.    fi
  406.    rm -f /tmp/tmpmsg /tmp/reply
  407.    break
  408.   elif [ "$REPLY" = "Skip" ]; then
  409.    rm -f /tmp/tmpmsg /tmp/reply
  410.    break
  411.   elif [ "$REPLY" = "View" ]; then
  412.    if [ -r /tmp/lilo.conf ]; then
  413.     dialog --title "YOUR NEW /etc/lilo.conf" --textbox "/tmp/lilo.conf" 22 70
  414.    else
  415.     if [ -r /mnt/etc/lilo.conf ]; then
  416.      dialog --title "YOUR OLD /etc/lilo.conf" --textbox "/mnt/etc/lilo.conf" 22 70
  417.     elif [ "$T_PX" = "/" -a -r /etc/lilo.conf ]; then
  418.      dialog --title "YOUR OLD /etc/lilo.conf" --textbox "/etc/lilo.conf" 22 70
  419.     else
  420.      dialog --title "NO CONFIG FILE FOUND" --msgbox "Sorry, but you don't \
  421. have a LILO configuration file that can be viewed." 6 60
  422.     fi
  423.    fi
  424.   elif [ "$REPLY" = "Help" ]; then
  425.    dialog --title "LILO INSTALLATION HELP" --textbox "$T_PX/usr/adm/setup/text.lilohelp" 22 68
  426.   fi
  427.  done
  428. else # don't use color!
  429.  while [ 0 ]; do
  430.   cat << EOF
  431.  
  432. LILO INSTALLATION
  433.  
  434. LILO (the Linux Loader) is the program that allows booting Linux directly from
  435. the hard drive. To install, you make a new LILO configuration file by creating
  436. a new header and then adding at least one bootable partition to the file. Once
  437. you've done this, you can select the install option. Alternately, if you 
  438. already have an /etc/lilo.conf, you may reinstall using that. If you make a
  439. mistake, just select (1) to start over.
  440.  
  441. 1 -- Start LILO configuration with a new LILO header
  442. 2 -- Add a Linux partition to the LILO config file
  443. 3 -- Add an OS/2 partition to the LILO config file
  444. 4 -- Add a DOS partition to the LILO config file
  445. 5 -- Install LILO
  446. 6 -- Reinstall LILO using the existing lilo.conf
  447. 7 -- Skip LILO installation and exit this menu
  448. 8 -- View your current /etc/lilo.conf
  449. 9 -- Read the Linux Loader HELP file
  450.  
  451. EOF
  452. echo -n "Which option would you like (1 - 9)? "
  453.   read REPLY;
  454.   echo
  455.   if [ "$REPLY" = "1" ]; then
  456.    cat << EOF
  457. OPTIONAL append="" LINE
  458.  
  459. Some systems might require extra parameters to be passed to the kernel in order
  460. to boot. An example would be the hd=cyl,hds,secs needed with some SCSI systems
  461. and some machines with IBM motherboards. If you needed to pass parameters to the
  462. kernel when you booted the Slackware bootkernel disk, you'll probably want to
  463. enter the same ones here. 
  464.  
  465. Most systems won't require any extra parameters. If you don't need any, just
  466. hit ENTER to continue.
  467.  
  468. EOF
  469.    echo -n "Enter extra parameters==> "
  470.    read APPEND;
  471.    echo
  472.    cat << EOF
  473. SELECT LILO TARGET LOCATION
  474.  
  475. LILO can be installed to a variety of places: 
  476.  1. The Master Boot Record of your first hard drive
  477.  2. The superblock of your root Linux partition (which could then
  478.     be made the bootable partition with fdisk)
  479.  3. A formatted floppy disk
  480.  
  481. If you're using a boot system such as OS/2's Boot Manager, you should install
  482. LILO on the superblock of your root Linux partition.
  483.  
  484. EOF
  485.    echo -n "Please pick a target location (1 - 3): "
  486.    read TG;
  487.    echo
  488.    if [ "$TG" = "1" ]; then
  489.     if [ -L $T_PX/dev/hda ]; then
  490.      LILO_TARGET="/dev/sda"
  491.     elif probe /dev/hda; then
  492.      LILO_TARGET="/dev/hda"
  493.     elif probe /dev/sda; then
  494.      LILO_TARGET="/dev/sda"
  495.     else
  496.      cat << EOF
  497. ***** ERROR probing for first hard drive.
  498.  
  499. LILO can't find your first hard drive! Sorry, but LILO is 
  500. getting /dev/null'ed...
  501. EOF
  502.      LILO_TARGET="/dev/null"
  503.     fi
  504.    elif [ "$TG" = "2" ]; then
  505.     LILO_TARGET=`echo $ROOT_DEVICE` # Here, we use the partition superblock for OS/2 Boot Manager
  506.    elif [ "$TG" = "3" ]; then
  507.     LILO_TARGET="/dev/fd0"    
  508.    else
  509.     HDR="no"
  510.     continue;
  511.    fi
  512.    cat << EOF
  513. CHOOSE LILO DELAY
  514.  
  515. How long would you like LILO to wait for you to hit left-shift to 
  516. get a prompt after rebooting? If you let LILO time out, it will boot
  517. the first OS in the configuration file by default.
  518.  
  519. 1 -- None, don't wait at all - boot straight into the first OS
  520. 2 -- 5 seconds
  521. 3 -- 30 seconds
  522. 4 -- Present a prompt and wait until a choice is made without timing out
  523.  
  524. EOF
  525.    echo -n "Which choice would you like (1 - 4)? "
  526.    read DELAY;
  527.    echo
  528.    if [ "$DELAY" = "1" ]; then 
  529.     DELAY="# delay = 5"
  530.    elif [ "$DELAY" = "2" ]; then
  531.     DELAY="delay = 50"
  532.    elif [ "$DELAY" = "3" ]; then
  533.     DELAY="delay = 300" 
  534.    elif [ "$DELAY" = "4" ]; then
  535.     DELAY="prompt"
  536.    else
  537.     HDR="no"
  538.     continue;
  539.    fi
  540.    if [ "$APPEND" = "" ]; then
  541.     cat << EOF > /tmp/lilo.conf
  542. # LILO configuration file
  543. # generated by 'liloconfig'
  544. #
  545. # Start LILO global section
  546. boot = $LILO_TARGET
  547. #compact        # faster, but won't work on all systems.
  548. $DELAY
  549. vga = normal    # force sane state
  550. ramdisk = 0     # paranoia setting
  551. # End LILO global section
  552. EOF
  553.     HDR="yes"
  554.    else
  555.     cat << EOF > /tmp/lilo.conf
  556. # LILO configuration file
  557. # generated by 'liloconfig'
  558. #
  559. # Start LILO global section
  560. append="$APPEND"
  561. boot = $LILO_TARGET
  562. #compact        # faster, but won't work on all systems.
  563. $DELAY
  564. vga = normal    # force sane state
  565. ramdisk = 0     # paranoia setting
  566. # End LILO global section
  567. EOF
  568.     HDR="yes"
  569.    fi
  570.   elif [ "$REPLY" = "2" ]; then
  571.    if [ "$HDR" = "yes" ]; then
  572.     while [ 0 ]; do
  573.      cat << EOF
  574. SELECT LINUX PARTITION
  575.  
  576. These are your Linux partitions:
  577.  
  578.    Device Boot  Begin   Start    End  Blocks   Id  System
  579. `fdisk -l | fgrep Linux | fgrep native` 
  580.  
  581. EOF
  582.      echo -n "Which one would you like LILO to boot? "
  583.      read LINUX_PART;
  584.      checkp_text $LINUX_PART
  585.      if [ $? = 0 ]; then
  586.       break;
  587.      fi
  588.     done
  589.     echo
  590.     cat << EOF
  591. SELECT PARTITION NAME
  592.  
  593. Now you must select a short, unique name for this partition. 
  594. You'll use this name if you specify a partition to boot at the 
  595. LILO prompt. 'Linux' might not be a bad choice.
  596.  
  597. THIS MUST BE A SINGLE WORD.
  598.  
  599. EOF
  600.     echo -n "Enter name: "
  601.     read LABEL;
  602.     cat << EOF >> /tmp/lilo.conf
  603. # Linux bootable partition config begins
  604. image = /vmlinuz
  605.   root = $LINUX_PART
  606.   label = $LABEL
  607. # Linux bootable partition config ends
  608. EOF
  609.    else
  610.     cat << EOF
  611. CAN'T ADD LINUX PARTITION
  612.  
  613. You can't add partitions unless you start over
  614. with a new LILO header.
  615.  
  616. EOF
  617.     echo -n "Press ENTER to continue."
  618.     read JUNK;
  619.     echo
  620.     continue
  621.    fi
  622.    LNX="yes"
  623.   elif [ "$REPLY" = "3" ]; then
  624.    if [ "$HDR" = "yes" ]; then
  625.     while [ 0 ]; do
  626.      cat << EOF
  627. SELECT OS/2 PARTITION
  628.  
  629. These are possibly OS/2 partitions. They will be treated
  630. as such if you install them using this menu.
  631.  
  632.    Device Boot  Begin   Start    End  Blocks   Id  System
  633. `fdisk -l | fgrep DOS`
  634. `fdisk -l | fgrep HPFS`
  635.  
  636. EOF
  637.      echo -n "Which one would you like LILO to boot? "
  638.      read OS_2_PART; 
  639.      checkp_text $OS_2_PART
  640.      if [ $? = 0 ]; then
  641.       break;
  642.      fi
  643.     done
  644.     echo
  645.     cat << EOF
  646. SELECT PARTITION NAME
  647.  
  648. Now you must select a short, unique name for this partition. 
  649. You'll use this name if you specify a partition to boot at the
  650. LILO prompt. 'OS/2' might not be a bad choice.
  651.  
  652. THIS MUST BE A SINGLE WORD.
  653.  
  654. EOF
  655.     echo -n "Enter name: "
  656.     read LABEL;
  657.     echo
  658.     TABLE="`echo $OS_2_PART | cut -b1-8`"
  659.     if [ "`echo $TABLE | cut -b6-8`" = "hda" ]; then
  660.      cat << EOF >> /tmp/lilo.conf
  661. # OS/2 bootable partition config begins
  662. other = $OS_2_PART
  663.   label = $LABEL
  664.   table = $TABLE
  665. # OS/2 bootable partition config ends
  666. EOF
  667.     else
  668.      cat << EOF >> /tmp/lilo.conf
  669. # OS/2 bootable partition config begins
  670. other = $OS_2_PART
  671.   label = $LABEL
  672.   table = $TABLE
  673.   loader = /boot/os2_d.b
  674. # OS/2 bootable partition config ends
  675. EOF
  676.     fi
  677.    else
  678.     cat << EOF
  679. CAN'T ADD OS/2 PARTITION
  680.  
  681. You can't add partitions unless you start over
  682. with a new LILO header.
  683.  
  684. EOF
  685.     echo -n "Press ENTER to continue."
  686.     read JUNK;
  687.     echo
  688.     continue
  689.    fi
  690.    LNX="yes"
  691.   elif [ "$REPLY" = "4" ]; then
  692.    if [ "$HDR" = "yes" ]; then
  693.     while [ 0 ]; do
  694.      cat << EOF
  695. SELECT DOS PARTITION
  696.  
  697. These are possibly DOS partitions. They will be treated
  698. as such if you install them using this menu.
  699.  
  700.    Device Boot  Begin   Start    End  Blocks   Id  System"
  701. `fdisk -l | fgrep DOS`
  702.  
  703. EOF
  704.      echo -n "Which one would you like LILO to boot? "
  705.      read DOSPART;
  706.      checkp_text $DOSPART
  707.      if [ $? = 0 ]; then
  708.       break;
  709.      fi
  710.     done
  711.     cat << EOF
  712.  
  713. SELECT PARTITION NAME
  714.  
  715. Now you must select a short, unique name for this partition. 
  716. You'll use this name if you specify a partition to boot at the 
  717. LILO prompt. 'DOS' might not be a bad choice.
  718.  
  719. THIS MUST BE A SINGLE WORD.
  720.  
  721. EOF
  722.     echo -n "Enter name: "
  723.     read LABEL;
  724.     echo
  725.     TABLE="`echo $DOSPART | cut -b1-8`"
  726.     unset USE_LOADER
  727.     if [ "`echo $TABLE | cut -b6-8`" = "hda" ]; then
  728.      USE_LOADER="no"
  729.     fi
  730.     if [ "`echo $TABLE | cut -b6-8`" = "sda" ]; then
  731.      if probe /dev/hda; then
  732.       USE_LOADER="yes"
  733.      else
  734.       USE_LOADER="no"
  735.      fi
  736.     fi
  737.     if [ "$USE_LOADER" = "no" ]; then
  738.      cat << EOF >> /tmp/lilo.conf
  739. # DOS bootable partition config begins
  740. other = $DOSPART
  741.   label = $LABEL
  742.   table = $TABLE
  743. # DOS bootable partition config ends
  744. EOF
  745.     else
  746.      cat << EOF >> /tmp/lilo.conf
  747. # DOS bootable partition config begins
  748. other = $DOSPART
  749.   label = $LABEL
  750.   loader = /boot/any_d.b
  751.   table = $TABLE
  752. # DOS bootable partition config ends
  753. EOF
  754.     fi
  755.    else
  756.     cat << EOF
  757. CAN'T ADD DOS PARTITION
  758.  
  759. You can't add partitions unless you start over
  760. with a new LILO header.
  761.  
  762. EOF
  763.     echo -n "Press ENTER to continue."
  764.     read JUNK;
  765.     echo
  766.     continue
  767.    fi
  768.    LNX="yes"
  769.   elif [ "$REPLY" = "5" -o "$REPLY" = "6" ]; then
  770.    if [ "$REPLY" = "6" -a -r $T_PX/etc/lilo.conf ]; then
  771.     LNX="yes"
  772.    fi
  773.    if [ "$LNX" = "no" ]; then
  774.     cat << EOF
  775. CAN'T INSTALL LILO
  776.  
  777. LILO could not be installed. If you have not created a LILO 
  778. configuration file by defining a new header and adding at least
  779. one bootable partition to it, you must do so before installing
  780. LILO. If you were attempting to use an existing LILO configuration
  781. file, it could not be found. Try making a new one.
  782.  
  783. EOF
  784.     echo -n "Press ENTER to continue."
  785.     read JUNK;
  786.     echo
  787.     continue
  788.    else
  789.     if [ "$REPLY" = "5" ]; then
  790.      if [ -r /tmp/lilo.conf ]; then
  791.       if [ -r $T_PX/etc/lilo.conf ]; then
  792.        mv $T_PX/etc/lilo.conf $T_PX/etc/lilo.conf.bak
  793.       fi
  794.       cp /tmp/lilo.conf $T_PX/etc/lilo.conf
  795.       chmod 644 $T_PX/etc/lilo.conf
  796.      fi
  797.     fi    
  798.     echo
  799.     echo "Installing the Linux Loader..." 
  800.     if [ "$T_PX" = "/" ]; then
  801.      /sbin/lilo
  802.     else
  803.      (cd $T_PX/sbin; ./lilo -r $T_PX -m /boot/map -C /etc/lilo.conf )
  804.     fi
  805.    fi
  806.    rm -f /tmp/tmpmsg /tmp/reply
  807.    break
  808.   elif [ "$REPLY" = "7" ]; then
  809.    rm -f /tmp/tmpmsg /tmp/reply
  810.    break
  811.   elif [ "$REPLY" = "8" ]; then
  812.    if [ -r /tmp/lilo.conf ]; then
  813.     if [ -r /bin/more ]; then
  814.      cat /tmp/lilo.conf | more
  815.     else
  816.      cat /tmp/lilo.conf
  817.     fi
  818.     echo -n "Press ENTER to continue..."
  819.     read JUNK;
  820.     echo
  821.    else
  822.     if [ -r /mnt/etc/lilo.conf ]; then
  823.      if [ -r /bin/more ]; then
  824.       cat /mnt/etc/lilo.conf | more
  825.      else
  826.       cat /mnt/etc/lilo.conf
  827.      fi
  828.      echo -n "Press ENTER to continue..."
  829.      read JUNK;
  830.      echo
  831.     elif [ "$T_PX" = "/" -a -r /etc/lilo.conf ]; then
  832.      if [ -r /bin/more ]; then
  833.       cat /etc/lilo.conf | more
  834.      else
  835.       cat /etc/lilo.conf
  836.      fi
  837.      echo -n "Press ENTER to continue..."
  838.      read JUNK;
  839.      echo
  840.     else
  841.      cat << EOF
  842.  
  843. NO CONFIG FILE FOUND
  844.  
  845. Sorry, but you don't have a LILO configuration file that can be viewed.
  846.  
  847. EOF
  848.      echo -n "Press ENTER to continue..."
  849.      read JUNK;
  850.      echo
  851.     fi
  852.    fi
  853.   elif [ "$REPLY" = "9" ]; then
  854.    if [ -r /bin/more ]; then
  855.     cat $T_PX/usr/adm/setup/text.lilohelp | more
  856.    else 
  857.     cat $T_PX/usr/adm/setup/text.lilohelp 
  858.     echo -n "Sorry... there's no pager on this disk. Press ENTER to continue."
  859.     read JUNK;
  860.     echo
  861.    fi
  862.   fi
  863.  done
  864.  echo
  865. fi # are we using color?
  866.